package com.liuzu.esys.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.liuzu.esys.bo.CommentBo;
import com.liuzu.esys.pojo.Comment;
import com.liuzu.esys.service.CommentService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

public class WebCommentListener extends AnalysisEventListener<CommentBo> {
    @Autowired
    CommentService commentService;


    @Override
    public void invoke(CommentBo data, AnalysisContext analysisContext) {
        System.out.println(data);
        Comment comment = new Comment();

        BeanUtils.copyProperties(data,comment);
        commentService.commentAdd(comment);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
